package com.androidhuman.example.DualPane;

import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.widget.TextView;

public class Detail extends Activity {

	public static final String KEY_INDEX = "index";
	private TextView contentText;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.detail);
	    contentText = (TextView)findViewById(R.id.contentText);
	    
	    if(getResources().getConfiguration().orientation==Configuration.ORIENTATION_PORTRAIT){
		    if(getIntent()!=null){
		    	int index = getIntent().getIntExtra(KEY_INDEX, 0);
		    	contentText.setText(DetailFragment.details[index]);
		    }else
		    	throw new IllegalStateException();
	    }else
	    	finish();
	}

}
